package dbutilsDemo.services;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import dbutilsDemo.mappers.BroadbandOnlineDAO;
import dbutilsDemo.model.BBroadbandOnline;

public class BroadbandOnlineBOImpl implements BroadbandOnlineBO {
	private BroadbandOnlineDAO broadbandOnlineDAO;

	@Override
	public BBroadbandOnline getOnline(String ip) {
		List<String> h = new ArrayList<String>();
		for (int i = 0; i < 6; i++) {
			h.add("0" + i);
		}
		Map<String, Object> map = new HashMap<String, Object>(2);
		map.put("ip", ip);
		map.put("hashList", h);
		List<BBroadbandOnline> list = broadbandOnlineDAO.getOnlineInfo(map);
		if (list == null || list.isEmpty()) {
			return null;
		}
		return list.get(0);
	}

	public BroadbandOnlineDAO getBroadbandOnlineDAO() {
		return broadbandOnlineDAO;
	}

	public void setBroadbandOnlineDAO(BroadbandOnlineDAO broadbandOnlineDAO) {
		this.broadbandOnlineDAO = broadbandOnlineDAO;
	}


}
